<template>
	<view class="page page-fill">
		<view class="header">
			<!-- 判断是否登录的头像 信息-->
			<view v-if="userIsLogin">
				<image :src="userInfo.faceImage" class="face" mode=""></image>
			</view>
			<view v-else>
				<image src="http://122.152.205.72:88/group1/M00/00/05/CpoxxFw_-5-AFyVyAABLIH8xBTw233.png" class="face" mode=""></image>

			</view>
			<view class="info-wrapper" v-if="userIsLogin">
				<view class="nickname">{{userInfo.nickname}}</view>
				<view class="nav-info">{{userInfo.id}}</view>
			</view>
			<view v-else>
				<navigator url="../register/register">
					<view class="nickname regist-login">
						注册/登录
					</view>
				</navigator>
			</view>
			<view class="set-wrapper" v-if="userIsLogin">
				<navigator url="../meInfo/meInfo">
					<image  src="http://www.imovietrailer.com/static/icos/settings.png" class="setting" mode=""></image>
				</navigator>
			</view>
			<mask v-if="showMask"></mask>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userIsLogin:false,
				userInfo:{},
				showMask:false
			}
		},
		onBackPress() {  
			if(this.showMask) {  
				this.showMask = false;  
				return true;  
			}  
		},
		onShow(){
			var me=this;
			// console.log(me.userInfo);
			// //用户状态的切换  globalUser 从注册传过来的
			var userInfo=uni.getStorageSync("globalUser");
			if(userInfo!=null&&userInfo!=""&&userInfo!=undefined){
				me.userIsLogin=true;
				me.userInfo=userInfo;
			}else{
				me.userIsLogin=false;
				me.userInfo=userInfo;
			}
			
			// 使用挂载方法获取用户数据
			// var userInfo=me.getGlobalUser("globalUser");
			// if(userInfo!=null){
			// 	me.userIsLogin=true;
			// 	me.userInfo=userInfo;
			// }else{
			// 	me.userIsLogin=false;
			// 	me.userInfo=userInfo;
			// }
			
		},
		methods: {
		
		},
			
	}
	import mask from "@/components/uni-icon/mask.vue"
</script>

<style>
	@import url("me.css");
</style>
